package org.zcl.listener;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;
import org.zcl.mq.MessageQueue;

/**
 * .
 *
 * @author zhuchenglin
 * @since 2024/7/19 17:35
 */
@Component
@EnableBinding(MessageQueue.Recv.class)
public class ReceiveMessageListener {
    @Value("${server.port}")
    private String serverPort;

    @StreamListener(MessageQueue.Recv.Name)
    public void input(Message<String> message) {
        System.out.println("消费者1号，------->接收到的消息：" + message.getPayload() + "\t port: " + serverPort);
    }
}